package cn.tips.dmp.supports.jpa;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;

import java.util.Optional;


/**
 * 为JPA中createBy与lastModifiedBy审计设置用户ID
 *
 * @author pkb
 */
@Configuration
public class StUserIDAuditor implements AuditorAware<String> {

    @Override
    public Optional<String> getCurrentAuditor() {
        // 返回shiro当前登录用户
        String userId = "1";
        return Optional.of(userId);
    }
}
